﻿<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:view="clr-namespace:TrackMe.View"
        mc:Ignorable="d"
        x:Class="TrackMe.View.WidgetWindow"
        Title="TimeTracker"
        AllowsTransparency="True"
        ResizeMode="NoResize"
        ShowInTaskbar="False"
        Topmost="True"
        WindowState="Normal"
        WindowStyle="None"
        WindowStartupLocation="Manual"
        xmlns:vm="clr-namespace:TrackMe.Apps.VM;assembly=TrackMe.Apps"
        d:DataContext="{d:DesignInstance vm:WidgetVM}"
        MouseDoubleClick="WindowMouseDoubleClick"
        FontSize="12"
        Closing="WindowClosing"
        KeyDown="WindowKeyDown"
        Icon="images\clock_16.ico"
        MouseLeave="WindowMouseLeave"
        MouseEnter="WindowMouseEnter"
        Width="390"
        Height="200"
        SizeChanged="WidgetWindow_OnSizeChanged"
        Background="Transparent"><!--SizeToContent="Height" -->

	<Window.Resources>

		<view:TimeSpanConverter x:Key="TimeSpanConverter" />
	</Window.Resources>

	<Grid>
		<Border BorderThickness="2"
		        CornerRadius="10"
		        BorderBrush="#FF5E748F"
		        Background="{DynamicResource ListBackground}">
			<TabControl Margin="5,5,6,6"
			            Background="{DynamicResource ListBackground}"
			            SelectedItem="{Binding SelectedTab, Mode=OneWayToSource}" BorderThickness="0">
				<TabItem Header="Stats">
					<Border CornerRadius="6"
					        Background="#FFE3E7EF">
						<StackPanel>
							<WrapPanel>
								<TextBlock Text="{Binding CurrentUser.Name}"
								           Effect="{DynamicResource DescribingText}" />
								<TextBlock Text=", you are "
								           Effect="{DynamicResource DescribingText}" />
								<TextBlock Text="{Binding CurrentTask.ProjectName}"
								           Foreground="SteelBlue"
								           Effect="{DynamicResource DescribingText}" />
								<TextBlock Text=":"
								           Effect="{DynamicResource DescribingText}" />
								<TextBlock Text="{Binding CurrentTask.TaskName}"
								           Foreground="Red"
								           Effect="{DynamicResource DescribingText}" />
								<TextBlock Text="("
								           Effect="{DynamicResource DescribingText}" />
								<TextBlock Text=" Some Description "
								           Foreground="Red"
								           Effect="{DynamicResource DescribingText}" />
								<TextBlock Text=")"
								           Effect="{DynamicResource DescribingText}" />
								<TextBlock Text=" since "
								           Effect="{DynamicResource DescribingText}" />
								<TextBlock Text="{Binding CurrentJob.StartTime}"
								           Effect="{DynamicResource DescribingText}" />
							</WrapPanel>
							<Grid>
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="219" />
									<ColumnDefinition Width="134" />
								</Grid.ColumnDefinitions>
								<TextBox x:Name="ctrlDescription"
								         Grid.Column="0" />
								<WrapPanel Grid.Column="1">
									<Button Command="{Binding StartCmd}"
									        Content="Start" />
									<Button Command="{Binding StopCmd}"
									        Content="Stop" />
									<Button Command="{Binding ReportsCmd}"
									        Content="Reps" />
								</WrapPanel>
							</Grid>
							<UniformGrid Rows="4"
							             Columns="4"
							             DataContext="{Binding Matrix}"
							             Margin="2,0">
								<TextBlock Text=""
								           Background="#FF35547F" />
								<TextBlock Text="TODAY"
								           Style="{DynamicResource GridHeader}"
								           TextAlignment="Right"
								           Padding="0,0,4,0" />
								<TextBlock Text="MONTH"
								           Style="{DynamicResource GridHeader}"
								           TextAlignment="Right"
								           Padding="0,0,4,0" />
								<TextBlock Text="TOTAL"
								           Style="{DynamicResource GridHeader}"
								           TextAlignment="Right"
								           Padding="0,0,4,0" />
								<TextBlock Text="Total"
								           HorizontalAlignment="Center" />
								<TextBlock Text="{Binding TodayTotal, Converter={StaticResource TimeSpanConverter}}"
								           TextAlignment="Right"
								           Padding="0,0,4,0" />
								<TextBlock Text="{Binding MonthTotal, Converter={StaticResource TimeSpanConverter}}"
								           TextAlignment="Right"
								           Padding="0,0,4,0" />
								<TextBlock Text="{Binding TotalTotal, Converter={StaticResource TimeSpanConverter}}"
								           TextAlignment="Right"
								           Padding="0,0,4,0" />
								<TextBlock Text="Project"
								           HorizontalAlignment="Center" />
								<TextBlock Text="{Binding TodayProject, Converter={StaticResource TimeSpanConverter}}"
								           TextAlignment="Right"
								           Padding="0,0,4,0" />
								<TextBlock Text="{Binding MonthProject, Converter={StaticResource TimeSpanConverter}}"
								           TextAlignment="Right"
								           Padding="0,0,4,0" />
								<TextBlock Text="{Binding TotalProject, Converter={StaticResource TimeSpanConverter}}"
								           TextAlignment="Right"
								           Padding="0,0,4,0" />
								<TextBlock Text="Task"
								           HorizontalAlignment="Center" />
								<TextBlock Text="{Binding TodayTask, Converter={StaticResource TimeSpanConverter}}"
								           TextAlignment="Right"
								           Padding="0,0,4,0" />
								<TextBlock Text="{Binding MonthTask, Converter={StaticResource TimeSpanConverter}}"
								           TextAlignment="Right"
								           Padding="0,0,4,0" />
								<TextBlock Text="{Binding TotalTask, Converter={StaticResource TimeSpanConverter}}"
								           TextAlignment="Right"
								           Padding="0,0,4,0" />
							</UniformGrid>
						</StackPanel>
					</Border>
				</TabItem>
				<TabItem Header="Recent">
					<Grid x:Name="RecentSpot" />
				</TabItem>
				<TabItem Header="Search">
					<Grid x:Name="SearchSpot" />
				</TabItem>
				<TabItem Header="Create">
					<Grid x:Name="CreateSpot"
					      Background="#FFECF1F9" />
				</TabItem>
			</TabControl>
		</Border>
		<Button Style="{StaticResource RoundButton}"
		        Name="ButtonExit"
		        Height="18"
		        Width="18"
		        HorizontalAlignment="Right"
		        VerticalAlignment="Top"
		        Margin="4"
		        Background="#FF1D5BBA"
		        Click="ButtonExitClick">
			<TextBlock Text="X"
			           FontWeight="Bold"
			           FontSize="8"
			           Foreground="#FF1D5BBA"
			           VerticalAlignment="Center" />
		</Button>
	</Grid>
</Window>